//
//  RMDefines.h
//  RM_IM
//
//  Created by user1 on 2018/6/12.
//  Copyright © 2018年 user1. All rights reserved.
//

#ifndef RMDefines_h
#define RMDefines_h
#import <Foundation/Foundation.h>

#ifdef DEBUG
#define IMLog(...)   NSLog(__VA_ARGS__)
#else
#define IMLog(...)
#endif

/*  weakself*/
#define WeakSelf __weak typeof(self) weakSelf = self;
#define WeakObj(objc) __weak typeof(objc) objc##Weak = objc;

/*  自动释放池 */
#define AutoRelease_for(...) for(__VA_ARGS__) @autoreleasepool

/*  获取屏幕尺寸 */
#define SCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define RUIWindow ((UIWindow *)[((AppDelegate *)[[UIApplication sharedApplication] delegate]) window])
#define App_RootCtroller  [UIApplication sharedApplication].keyWindow.rootViewController

/*  屏幕适配 */
#define Fix375(x) ((CGFloat)((x) * (SCREEN_WIDTH / 375.0)))
#define RMFont(x)    [UIFont systemFontOfSize:x*SCREEN_WIDTH/375.0]
#define RMSemFont(x) [UIFont systemFontOfSize:x*SCREEN_WIDTH/375.0 weight:UIFontWeightSemibold];
#define RMMedFont(x) [UIFont systemFontOfSize:x*SCREEN_WIDTH/375.0 weight:UIFontWeightMedium];
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define ONEPIXER 1/[[UIScreen mainScreen] scale]    //1像素

/*  判断机型 */
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

/*  系统判断 */
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IOS_11 @available(iOS 11.0, *)
#define IOS_10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0f)
#define IOS_9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0f)
#define IOS_8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0f)


/*  iphoneX */
#define NavBarHeight (iPhoneX? 88.f:64.f)
#define TabBarHeight (iPhoneX? 83.f:49.f)
#define TabBarSafeBottomMargin (iPhoneX? 34.f:0) //安全区域距底部间距
#define StatusBarMargin (iPhoneX? 24:0)

/** 定义的常量 */
#define KpageSize 10
static NSString *DownLoadFileDicKey = @"DownLoadFileDicKey";
#pragma mark - ******** 静态字段 ********
/**发布界面*/
//更新下载次数
static NSString *NotiUpdateDownLoadCount = @"NotiUpdateDownLoadCount";
static NSString *NotiPublishNoticeSuccess = @"NotiPublishNoticeSuccess";
/**网络*/
static NSString * NetStatusKey = @"NetStatusKey";
static NSString * NotificationNetStatusChange = @"NotificationNetStatusChange";
static NSString * NetStatusWiFi = @"AFNetworkReachabilityStatusReachableViaWiFi";
static NSString * NetStatusWWAN = @"AFNetworkReachabilityStatusReachableViaWWAN";
static NSString * NetStatusNotReachable = @"AFNetworkReachabilityStatusNotReachable";
static NSString * NetStatusNotUnknown = @"AFNetworkReachabilityStatusUnknown";

/**数据库*/
//上一次视频播放时刻
static NSString * VideoLoadTimeBufferDBName = @"VideoLoadTimeBufferDBName";
static NSString * VideoLoadTimeBufferDBTableName = @"VideoLoadTimeBufferDBTableName";

/** 消息通知*/
static NSString *MessageSetUpTop = @"MessageSetUpTop";
static NSString *MessageSetUpTopTime = @"MessageSetUpTopTime";
/**登录 和修改个人资料*/
static NSString *NTESNotificationLogout = @"NTESNotificationLogout";
static NSString *NotiUpdatePersonalMessage = @"NotiUpdatePersonalMessage";

/** 群组设置通知*/
static NSString *GroupMessageSetUpTop = @"GroupMessageSetUpTop";       //置顶 - 取消置顶
static NSString *GroupClearAllMessage = @"GroupClearAllMessage";       //清空聊天记录
static NSString *QuitGroupClearRecentSession = @"QuitGroupClearRecentSession";  //退出群聊-清空会话列表

/**群组文件下载次数更新通知*/
static NSString *NotiGroupFileDownLoadSuccess = @"NotiGroupFileDownLoadSuccess";
/**图片保存的通知*/
static NSString *NotiSavePhoto = @"NotiSavePhoto";
/**群组加人成功通知*/
static NSString *NotiGroupChangeAddMember = @"NotiGroupChangeAddMember";
/**创建群聊成功通知*/
static NSString *NotiCreateGroupSuccess = @"NotiCreateGroupSuccess";
/**未读消息通知*/
static NSString *NotiUnderMessageCount = @"NotiUnderMessageCount";
#endif /* RMDefines_h */
